<div class="layuimini-main">
    <!--
    这里对某些name作了修改
    -->

    <div class="layui-form layuimini-form">
        <div class="layui-form-item">
            <label class="layui-form-label required">标签名</label>
            <div class="layui-input-block">
                <input type="text" name="name" lay-verify="required" lay-reqtext="标签名不能为空" placeholder="请输入标签名" value="" class="layui-input">
                <tip>填写标签的名称，如诺贝尔奖获得者。</tip>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">备注信息</label>
            <div class="layui-input-block">
                <textarea name="description" class="layui-textarea" placeholder="请输入备注信息"></textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['form', 'table'], function () {
        var form = layui.form,
            layer = layui.layer,
            table = layui.table,
            $ = layui.$;

        /**
         * 初始化表单，要加上，不然刷新部分组件可能会不加载
         */
        form.render();
        var rootPath = BasePath+'api/'

        // 当前弹出层，防止ID被覆盖
        var parentIndex = layer.index;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            jq1111.ajax({
                type: 'POST',
                url: rootPath+'ResourceTag/Add',
                data: JSON.stringify(data.field),
                xhrFields: {
                    withCredentials: true
                },
                dataType: 'json',
                contentType: 'application/json',
                success: function () {
                    tablerender();
                    layer.closeAll();

                }//这里是要调用父页面的渲染方法
            });
            console.log(JSON.stringify(data.field));
            /*
            var index = layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            */

            }, function () {
                // 关闭弹出层
                layer.close(index);
                layer.close(parentIndex);
            });


            return false;
        });
        //添加



</script>